package cn.byapps.hw.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

@Entity
@Table(name = "HomeWork")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "Assignment_type")
@Data
@AllArgsConstructor
@NoArgsConstructor
/**
 * 作业基类（HomeWork与Material两个实体类共用一个数据表）
 */
public class Assignment implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", length = 30)
    private Integer id;
    @Column(name = "name", length = 50)
    private String name;
    @Temporal(TemporalType.TIMESTAMP)
    private Date endTime;// 截止时间
    @Column(name = "publishTime", updatable = false, insertable = true)
    private Date publishTime = new Date();// 发布时间

}
